package com.example.ddz.framework;

/**
 * Created by IntelliJ IDEA.
 * User: Marcel Melzig
 * Date: 30.05.11
 * Time: 19:23
 */

/**
 * The interface defines the needed methods to deal with graphical resources.
 *
 * @author Marcel Melzig
 * @version 0.0.2
 */
public interface IGraphics
{
    /**
     * This enumeration defines the modes which can be used to encode the colors of a graphical item.
     * It's called the color model.
     */
    public static enum PixmapFormat
    {
        ARGB8888,
        ARGB4444,
        RGB565
    }

    /**
     * This methods loads a new file in form of a Pixmap object.
     *
     * @param filename path to the given image.
     * @param format   The format of the given file.
     * @return An object representation of the loaded file in the form of a Pixmap object.
     */
    public IPixmap NewPixmap(String filename, PixmapFormat format);

    /**
     * Clears the complete framebuffer with the given color.
     *
     * @param color The color which should be cleared.
     */
    public void Clear(int color);

    /**
     * The pixel on the specified coordinate is been set to the specified color.
     *
     * @param x     The x coordinate of the pixel.
     * @param y     The y coordinate of the pixel.
     * @param color The color the pixel is been set to.
     */
    public void DrawPixel(int x, int y, int color);

    /**
     * Draws a line from the the point with the coordinates x and y to the point with the coordinates x2 and y2 with the
     * color specified by the color parameter.
     *
     * @param x     The x coordinate of the line.
     * @param y     The y coordinate of the line.
     * @param x2    The destination x coordinate of the line.
     * @param y2    The destination y coordinate of the line.
     * @param color The color of the line.
     */
    public void DrawLine(int x, int y, int x2, int y2, int color);

    /**
     * Draws a rectangle. The starting point is the point with the coordinate x and y. The rectangle has the width and
     * the height specified in the params. The rectangle is drawn in the given color. It will be drawn downwards from the
     * starting coordinate.
     *
     * @param x      The x coordinate of the rectangle.
     * @param y      The y coordinate of the rectangle.
     * @param width  The width of the rectangle.
     * @param height The height of the rectangle.
     * @param color  The color of the rectangle.
     */
    public void DrawRec(int x, int y, int width, int height, int color);

    /**
     * This methods draws parts of a pixmap to the framebuffer. The top-left corner of the drawn location is specified by
     * the x and y coordinate. With the parameters srcX, srcY, srcWidth, and srcHeight is the part of the pixmap described
     * which will be drawn.
     *
     * @param pixmap    The pixmap.
     * @param x         The x coordinate.
     * @param y         The y coordinate.
     * @param srcX      The x coordinate of the source pixmap.
     * @param srcY      The y coordinate of the source pixmap.
     * @param srcWidth  The width of the source pixmap.
     * @param srcHeight The height of the source pixmap.
     */
    public void DrawPixmap(IPixmap pixmap, int x, int y, int srcX, int srcY, int srcWidth, int srcHeight);

    /**
     * This method draws a pixmap from the specified coordinate downwards.
     *
     * @param pixmap The pixmap.
     * @param x      The x coordinate.
     * @param y      The y coordinate.
     */
    public void DrawPixmap(IPixmap pixmap, int x, int y);

    /**
     * Gets the width of the framebuffer in pixels.
     *
     * @return The width of the framebuffer.
     */
    public int GetWidth();

    /**
     * Gets the height of the framebuffer in pixels.
     *
     * @return The height of the framebuffer.
     */
    public int GetHeight();
}
